package com.tarena.lbs.coupon.dao.repository.impl;

import com.tarena.lbs.coupon.dao.mapper.CouponCodeMapper;
import com.tarena.lbs.coupon.dao.repository.CouponCodeRepository;
import com.tarena.lbs.coupon.pojo.po.CouponCodePO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;

import static com.baomidou.mybatisplus.extension.toolkit.SimpleQuery.selectList;

@Slf4j
@Repository
public class CouponCodeRepositoryImpl implements CouponCodeRepository {
    @Autowired
    private CouponCodeMapper couponCodeMapper;

    @Override
    public void updateById(CouponCodePO updatePO) {
        couponCodeMapper.updateById(updatePO);
        log.info("更新优惠码成功");
    }

    @Override
    public void save(CouponCodePO po) {
        log.debug("保存优惠码信息", po);
        couponCodeMapper.insert(po);

    }

    @Override
    public List<String> getList() {
        return couponCodeMapper.selectList();
    }
}
